home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / networking / dumpnetworksetup / network setup sdk bits / networksetup.h next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  50.2 KB  |  1,491 lines

  1. /*
  2.      File:        NetworkSetup.h
  3.  
  4.      Contains:    Network Setup Interfaces
  5.  
  6.      Version:    Technology:    1.1.0
  7.                  Release:    Universal Interfaces 3.3d2 (Sonata/Carbon Seed)
  8.  
  9.      Copyright:    © 1998-1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __NETWORKSETUP__
  18. #define __NETWORKSETUP__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __FILES__
  25. #include <Files.h>
  26. #endif
  27.  
  28.  
  29. #include <OpenTransport.h>
  30. #include <OpenTptInternet.h>
  31.  
  32.  
  33. #if PRAGMA_ONCE
  34. #pragma once
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_STRUCT_ALIGN
  46.     #pragma options align=mac68k
  47. #elif PRAGMA_STRUCT_PACKPUSH
  48.     #pragma pack(push, 2)
  49. #elif PRAGMA_STRUCT_PACK
  50.     #pragma pack(2)
  51. #endif
  52.  
  53. #if CALL_NOT_IN_CARBON
  54. #ifndef __NETWORKSETUPTYPES__
  55. #define __NETWORKSETUPTYPES__
  56. typedef struct OpaqueCfgDatabaseRef*     CfgDatabaseRef;
  57. typedef UInt32                             CfgAreaID;
  58. typedef OSType                             CfgEntityClass;
  59. typedef OSType                             CfgEntityType;
  60.  
  61. struct CfgEntityRef {
  62.     CfgAreaID                         fLoc;
  63.     UInt32                             fReserved;
  64.     Str255                             fID;
  65. };
  66. typedef struct CfgEntityRef                CfgEntityRef;
  67.  
  68. struct CfgResourceLocator {
  69.     FSSpec                             fFile;
  70.     UInt16                             fResID;
  71. };
  72. typedef struct CfgResourceLocator        CfgResourceLocator;
  73.  
  74. struct CfgEntityInfo {
  75.     CfgEntityClass                     fClass;
  76.     CfgEntityType                     fType;
  77.     Str255                             fName;
  78.     CfgResourceLocator                 fIcon;
  79. };
  80. typedef struct CfgEntityInfo            CfgEntityInfo;
  81.  
  82. typedef void *                            CfgEntityAccessID;
  83.  
  84. struct CfgPrefsHeader {
  85.     UInt16                             fSize;                        /* size includes this header*/
  86.     UInt16                             fVersion;
  87.     OSType                             fType;
  88. };
  89. typedef struct CfgPrefsHeader            CfgPrefsHeader;
  90. /*    -------------------------------------------------------------------------
  91.     Error codes
  92.     ------------------------------------------------------------------------- */
  93. enum {
  94.     kCfgErrDatabaseChanged        = -3290,                        /* database has changed since last call - close and reopen DB*/
  95.     kCfgErrAreaNotFound            = -3291,                        /* Area doesn't exist*/
  96.     kCfgErrAreaAlreadyExists    = -3292,                        /* Area already exists*/
  97.     kCfgErrAreaNotOpen            = -3293,                        /* Area needs to open first*/
  98.     kCfgErrConfigLocked            = -3294,                        /* Access conflict - retry later*/
  99.     kCfgErrEntityNotFound        = -3295,                        /* An entity with this name doesn't exist*/
  100.     kCfgErrEntityAlreadyExists    = -3296,                        /* An entity with this name already exists*/
  101.     kCfgErrPrefsTypeNotFound    = -3297,                        /* An record with this PrefsType doesn't exist*/
  102.     kCfgErrDataTruncated        = -3298,                        /* Data truncated when read buffer too small*/
  103.     kCfgErrFileCorrupted        = -3299                            /* The database format appears to be corrupted.*/
  104. };
  105.  
  106. /*    reserve a 'free' tag for free blocks*/
  107. enum {
  108.     kCfgTypefree                = FOUR_CHAR_CODE('free')
  109. };
  110.  
  111. /*    -------------------------------------------------------------------------
  112.     CfgEntityClass / CfgEntityType
  113.  
  114.     The database can distinguish between several classes of objects and 
  115.     several types withing each class
  116.     Use of different classes allow to store type of information in the same database
  117.  
  118.     Other entity classes and types can be defined by developers.
  119.     they should be unique and registered with Developer Tech Support (DTS)
  120.     ------------------------------------------------------------------------- */
  121. enum {
  122.     kCfgClassAnyEntity            = FOUR_CHAR_CODE('****'),
  123.     kCfgClassUnknownEntity        = FOUR_CHAR_CODE('????'),
  124.     kCfgTypeAnyEntity            = FOUR_CHAR_CODE('****'),
  125.     kCfgTypeUnknownEntity        = FOUR_CHAR_CODE('????')
  126. };
  127.  
  128. /*    -------------------------------------------------------------------------
  129.     For CfgIsSameEntityRef
  130.     ------------------------------------------------------------------------- */
  131. enum {
  132.     kCfgIgnoreArea                = true,
  133.     kCfgDontIgnoreArea            = false
  134. };
  135.  
  136. #endif    /* __NETWORKSETUPTYPES__ */
  137. /*******************************************************************************
  138. **    Configuration Information Access API 
  139. ********************************************************************************/
  140. /*    -------------------------------------------------------------------------
  141.     Database access
  142.     ------------------------------------------------------------------------- */
  143. EXTERN_API( OSStatus )
  144. OTCfgOpenDatabase                (CfgDatabaseRef *        dbRef);
  145.  
  146. /*
  147.     OTCfgOpenDatabase()
  148.  
  149.     Inputs:        none
  150.     Outputs:    CfgDatabaseRef* dbRef            Reference to opened database
  151.     Returns:    OSStatus                        *** list errors ***
  152.  
  153.     Opens the Configuration API for a given client. This call should be made prior to any other call.
  154. */
  155. EXTERN_API( OSStatus )
  156. OTCfgCloseDatabase                (CfgDatabaseRef *        dbRef);
  157.  
  158. /*
  159.     OTCfgCloseDatabase()
  160.  
  161.     Inputs:        CfgDatabaseRef* dbRef            Reference to opened database
  162.     Outputs:    CfgDatabaseRef* dbRef            Reference to opened database is cleared
  163.     Returns:    OSStatus                        *** list errors ***
  164.  
  165.     Closes the Configuration API for a given client. This call should be made when the client no 
  166.     longer wants to use the Configuration API.  
  167. */
  168. /*    -------------------------------------------------------------------------
  169.     Area management
  170.     ------------------------------------------------------------------------- */
  171. EXTERN_API( OSStatus )
  172. OTCfgGetAreasCount                (CfgDatabaseRef         dbRef,
  173.                                  ItemCount *            itemCount);
  174.  
  175. /*
  176.     OTCfgGetAreasCount()
  177.  
  178.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  179.     Outputs:    ItemCount* itemCount            Number of entities defined
  180.     Returns:    OSStatus                        *** list errors ***
  181.  
  182.     Returns the number of areas currently defined.
  183. */
  184. EXTERN_API( OSStatus )
  185. OTCfgGetAreasList                (CfgDatabaseRef         dbRef,
  186.                                  ItemCount *            itemCount,
  187.                                  CfgAreaID                 areaID[],
  188.                                  Str255                 areaName[]);
  189.  
  190. /*
  191.     OTCfgGetAreasList()
  192.  
  193.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  194.                 ItemCount* itemCount            Number of entities requested
  195.     Outputs:    ItemCount* itemCount            Number of entities defined
  196.     Returns:    OSStatus                        *** list errors ***
  197.  
  198.     Returns a list of area IDs and names. On entry, count should be set to whatever OTCfgGetAreasCount 
  199.     returned.  On exit, count contains the actual number of areas found. This can be less than the 
  200.     initial count value if areas were deleted in the meantime.  The id and name parameters are stored 
  201.     in arrays that should each be able to contain count values.
  202. */
  203. EXTERN_API( OSStatus )
  204. OTCfgGetCurrentArea                (CfgDatabaseRef         dbRef,
  205.                                  CfgAreaID *            areaID);
  206.  
  207. /*
  208.     OTCfgGetCurrentArea()
  209.  
  210.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  211.     Outputs:    CfgAreaID* areaID                ID of current area
  212.     Returns:    OSStatus                        *** list errors ***
  213.  
  214.     Returns the id of the current area.
  215. */
  216. EXTERN_API( OSStatus )
  217. OTCfgSetCurrentArea                (CfgDatabaseRef         dbRef,
  218.                                  CfgAreaID                 areaID);
  219.  
  220. /*
  221.     OTCfgSetCurrentArea()
  222.  
  223.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  224.                 CfgAreaID areaID                ID of area to make active
  225.     Outputs:    none
  226.     Returns:    OSStatus                        *** list errors ***
  227.  
  228.     Sets the current area. If the area doesn’t exist kCfgErrAreaNotFound is returned.
  229. */
  230. EXTERN_API( OSStatus )
  231. OTCfgCreateArea                    (CfgDatabaseRef         dbRef,
  232.                                  ConstStr255Param         areaName,
  233.                                  CfgAreaID *            areaID);
  234.  
  235. /*
  236.     OTCfgCreateArea()
  237.  
  238.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  239.                 ConstStr255Param areaName        Name of area to create
  240.     Outputs:    CfgAreaID* areaID                ID of newly created area
  241.     Returns:    OSStatus                        *** list errors ***
  242.  
  243.     Creates a new area with the specified name. Then name must be unique or kCfgErrAreaAlreadyExists 
  244.     will be returned.
  245. */
  246. EXTERN_API( OSStatus )
  247. OTCfgDeleteArea                    (CfgDatabaseRef         dbRef,
  248.                                  CfgAreaID                 areaID);
  249.  
  250. /*
  251.     OTCfgDeleteArea()
  252.  
  253.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  254.                 CfgAreaID areaID                ID of area to delete
  255.     Outputs:    none
  256.     Returns:    OSStatus                        *** list errors ***
  257.  
  258.     Deletes the specified area. If the area doesn’t exist kCfgErrAreaNotFound is returned.
  259. */
  260. EXTERN_API( OSStatus )
  261. OTCfgDuplicateArea                (CfgDatabaseRef         dbRef,
  262.                                  CfgAreaID                 sourceAreaID,
  263.                                  CfgAreaID                 destAreaID);
  264.  
  265. /*
  266.     OTCfgDuplicateArea()
  267.  
  268.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  269.                 CfgAreaID sourceAreaID            Area to duplicate
  270.                 CfgAreaID destAreaID            Area to contain duplicate
  271.     Outputs:    none
  272.     Returns:    OSStatus                        *** list errors ***
  273.  
  274.     Duplicates the source area content into the destination area. Both areas should exist prior to 
  275.     making this call. If either area doesn’t exist kCfgErrAreaNotFound is returned.
  276. */
  277. EXTERN_API( OSStatus )
  278. OTCfgSetAreaName                (CfgDatabaseRef         dbRef,
  279.                                  CfgAreaID                 areaID,
  280.                                  ConstStr255Param         areaName,
  281.                                  CfgAreaID *            newAreaID);
  282.  
  283. /*
  284.     OTCfgSetAreaName()
  285.  
  286.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  287.                 CfgAreaID areaID                ID of area being named
  288.                 ConstStr255Param areaName        New name for area
  289.     Outputs:    CfgAreaID* newAreaID            ID of renamed area
  290.     Returns:    OSStatus                        *** list errors ***
  291.  
  292.     Renames the specified area. A new id is returned: it should be used from now on. If the area 
  293.     doesn’t exist kCfgErrAreaNotFound is returned.
  294. */
  295. EXTERN_API( OSStatus )
  296. OTCfgGetAreaName                (CfgDatabaseRef         dbRef,
  297.                                  CfgAreaID                 areaID,
  298.                                  Str255                 areaName);
  299.  
  300. /*
  301.     OTCfgGetAreaName()
  302.  
  303.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  304.                 CfgAreaID areaID                ID of area being queried
  305.     Outputs:    Str255 areaName                    Name of area
  306.     Returns:    OSStatus                        *** list errors ***
  307.  
  308.     Gets the name of the specified area. If the area doesn’t exist kCfgErrAreaNotFound is returned.
  309. */
  310. /*    -------------------------------------------------------------------------
  311.     Configuration Database API
  312.     
  313.     Single Writer ONLY!!!
  314.     ------------------------------------------------------------------------- */
  315. /*    -------------------------------------------------------------------------
  316.     Opening an area for reading
  317.     ------------------------------------------------------------------------- */
  318. EXTERN_API( OSStatus )
  319. OTCfgOpenArea                    (CfgDatabaseRef         dbRef,
  320.                                  CfgAreaID                 areaID);
  321.  
  322. /*
  323.     OTCfgOpenArea()
  324.  
  325.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  326.                 CfgAreaID areaID                ID of area to open
  327.     Outputs:    none
  328.     Returns:    OSStatus                        *** list errors ***
  329.  
  330.     Opens the specified area for reading. If the area doesn’t exist kCfgErrAreaNotFound is returned.
  331. */
  332. EXTERN_API( OSStatus )
  333. OTCfgCloseArea                    (CfgDatabaseRef         dbRef,
  334.                                  CfgAreaID                 areaID);
  335.  
  336. /*
  337.     OTCfgCloseArea()
  338.  
  339.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  340.                 CfgAreaID areaID                ID of area to close
  341.     Outputs:    none
  342.     Returns:    OSStatus                        *** list errors ***
  343.  
  344.     Closes an area opened for reading. If the area doesn’t exist kCfgErrAreaNotFound is returned.  
  345.     Opening an area for writing All modifications to an area should be performed as part of a 
  346.     transaction.
  347. */
  348. /*
  349.     For write access
  350. */
  351. EXTERN_API( OSStatus )
  352. OTCfgBeginAreaModifications        (CfgDatabaseRef         dbRef,
  353.                                  CfgAreaID                 readAreaID,
  354.                                  CfgAreaID *            writeAreaID);
  355.  
  356. /*
  357.     OTCfgBeginAreaModifications()
  358.  
  359.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  360.                 CfgAreaID readAreaID            ID of area opened for reading
  361.     Outputs:    CfgAreaID* writeAreaID            ID of area opened for modification
  362.     Returns:    OSStatus                        *** list errors ***
  363.  
  364.     Opens the specified area for writing. A new area id is provided.  This area id should be used to 
  365.     enumerate, add, delete, read and write to the modified data. The original id can still be used to 
  366.     access the original unmodified data. If the area doesn’t exist kCfgErrAreaNotFound is returned.
  367. */
  368. EXTERN_API( OSStatus )
  369. OTCfgCommitAreaModifications    (CfgDatabaseRef         dbRef,
  370.                                  CfgAreaID                 readAreaID,
  371.                                  CfgAreaID                 writeAreaID);
  372.  
  373. /*
  374.     OTCfgCommitAreaModifications()
  375.  
  376.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  377.                 CfgAreaID readAreaID            ID of area opened for reading
  378.                 CfgAreaID writeAreaID            ID of area opened for modification
  379.     Outputs:    none
  380.     Returns:    OSStatus                        *** list errors ***
  381.  
  382.     Closes an area opened for writing.  All modifications are committed and readers are informed that 
  383.     the database changed state ( kCfgStateChangedErr ). The areaID should be the id of the original 
  384.     area.  If the area doesn’t exist or the wrong id is passed, kCfgErrAreaNotFound is returned.
  385. */
  386. EXTERN_API( OSStatus )
  387. OTCfgAbortAreaModifications        (CfgDatabaseRef         dbRef,
  388.                                  CfgAreaID                 readAreaID);
  389.  
  390. /*
  391.     OTCfgAbortAreaModifications()
  392.  
  393.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  394.                 CfgAreaID readAreaID            ID of area opened for reading
  395.     Outputs:    none
  396.     Returns:    OSStatus                        *** list errors ***
  397.  
  398.     Closes an area opened for writing, discarding any modification. The areaID should be the id of 
  399.     the original area. If the area doesn’t exist or the wrong id is passed kCfgErrAreaNotFound is 
  400.     returned.
  401. */
  402. /*
  403.     Working with entities
  404.  
  405.     Entities can be manipulated as soon as an area has been opened.  The same calls work both for 
  406.     areas opened for reading or for modification. In the latter case, the calls can be used on the 
  407.     original or new area id to access the original data or the modified data.
  408. */
  409. /*
  410.     For everybody
  411.     Count receives the actual number of entities
  412. */
  413. EXTERN_API( OSStatus )
  414. OTCfgGetEntitiesCount            (CfgDatabaseRef         dbRef,
  415.                                  CfgAreaID                 areaID,
  416.                                  CfgEntityClass         entityClass,
  417.                                  CfgEntityType             entityType,
  418.                                  ItemCount *            itemCount);
  419.  
  420. /*
  421.     OTCfgGetEntitiesCount()
  422.  
  423.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  424.                 CfgAreaID areaID                ID of area to count
  425.                 CfgEntityClass entityClass        Class of entities to count
  426.                 CfgEntityType entityType        Type of entities to count
  427.     Outputs:    ItemCount* itemCount            Count of matching entities
  428.     Returns:    OSStatus                        *** list errors ***
  429.  
  430.     Returns the number of entities of the specified class and type in the specified area. To obtain 
  431.     all entities regardless of their class or type pass kCfgClassAnyEntity or kCfgTypeAnyEntity. If 
  432.     the area doesn’t exist or the wrong id is passed kCfgErrAreaNotFound is returned.
  433. */
  434.  
  435. /*
  436.     Count as input, is the number of entities to read;
  437.     count as output, receives the actual number of entities or the number you specified. 
  438. */
  439. EXTERN_API( OSStatus )
  440. OTCfgGetEntitiesList            (CfgDatabaseRef         dbRef,
  441.                                  CfgAreaID                 areaID,
  442.                                  CfgEntityClass         entityClass,
  443.                                  CfgEntityType             entityType,
  444.                                  ItemCount *            itemCount,
  445.                                  CfgEntityRef             entityRef[],
  446.                                  CfgEntityInfo             entityInfo[]);
  447.  
  448. /*
  449.     OTCfgGetEntitiesList()
  450.  
  451.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  452.                 CfgAreaID areaID                ID of area to list
  453.                 CfgEntityClass entityClass        Class of entities to list
  454.                 CfgEntityType entityType        Type of entities to list
  455.                 ItemCount* itemCount            Count of entities requested
  456.     Outputs:    ItemCount* itemCount            Count of entities listed
  457.     Returns:    OSStatus                        *** list errors ***
  458.  
  459.     Returns the list of entities of the specified class and type in the specified area. To obtain all 
  460.     entities regardless of their class or type pass kCfgClassAnyEntity or kCfgTypeAnyEntity. The 
  461.     count parameter should have the value obtained by CfgGetEntitiesCount.  On exit count may be less 
  462.     if some entities were deleted in the meantime. The id and info parameters should be arrays large 
  463.     enough to hold count entries. If the area doesn’t exist or the wrong id is passed 
  464.     kCfgErrAreaNotFound is returned.  The info array contains information about each entity, 
  465.     including its class, type, name and the area of its icon:
  466.  
  467.     struct CfgEntityInfo
  468.     {
  469.         CfgEntityClass        fClass;
  470.         CfgEntityType        fType;
  471.         ConstStr255Param    fName;
  472.         CfgResourceLocator    fIcon;
  473.     };
  474. */
  475. EXTERN_API( OSStatus )
  476. OTCfgCreateEntity                (CfgDatabaseRef         dbRef,
  477.                                  CfgAreaID                 areaID,
  478.                                  const CfgEntityInfo *    entityInfo,
  479.                                  CfgEntityRef *            entityRef);
  480.  
  481. /*
  482.     OTCfgCreateEntity()
  483.  
  484.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  485.                 CfgAreaID areaID                ID of area to contain entity
  486.                 CfgEntityInfo* entityInfo        Information that defines the entity
  487.     Outputs:    CfgEntityRef* entityRef            Reference to entity created
  488.     Returns:    OSStatus                        *** list errors ***
  489.  
  490.     Creates a new entity with the specified class, type and name and returns an id for it. If the 
  491.     area doesn’t exist or the wrong id is passed kCfgErrAreaNotFound is returned. If there is already 
  492.     an entity with the same name kCfgErrEntityAlreadyExists is returned.
  493. */
  494. EXTERN_API( OSStatus )
  495. OTCfgDeleteEntity                (CfgDatabaseRef         dbRef,
  496.                                  const CfgEntityRef *    entityRef);
  497.  
  498. /*
  499.     OTCfgDeleteEntity()
  500.  
  501.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  502.                 CfgEntityRef* entityRef            Reference to entity to delete
  503.     Outputs:    none
  504.     Returns:    OSStatus                        *** list errors ***
  505.  
  506.     Deletes the specified entity. If there is no entity with this id kCfgEntityNotfoundErr is returned
  507. */
  508. EXTERN_API( OSStatus )
  509. OTCfgDuplicateEntity            (CfgDatabaseRef         dbRef,
  510.                                  const CfgEntityRef *    entityRef,
  511.                                  const CfgEntityRef *    newEntityRef);
  512.  
  513. /*
  514.     OTCfgDuplicateEntity()
  515.  
  516.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  517.                 CfgEntityRef* entityRef            Reference to entity to duplicate
  518.     Outputs:    CfgEntityRef* newEntityRef        Reference to duplicate entity
  519.     Returns:    OSStatus                        *** list errors ***
  520.  
  521.     Duplicates the specified entity. Both entities should exit. If any entity doesn’t exist 
  522.     kCfgErrEntityNotFound is returned.
  523. */
  524. EXTERN_API( OSStatus )
  525. OTCfgSetEntityName                (CfgDatabaseRef         dbRef,
  526.                                  const CfgEntityRef *    entityRef,
  527.                                  ConstStr255Param         entityName,
  528.                                  CfgEntityRef *            newEntityRef);
  529.  
  530. /*
  531.     OTCfgSetEntityName()
  532.  
  533.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  534.                 CfgEntityRef* entityRef            Reference to entity to duplicate
  535.                 ConstStr255Param entityName        New name for entity
  536.     Outputs:    CfgEntityRef* newEntityRef        Reference to renamed entity
  537.     Returns:    OSStatus                        *** list errors ***
  538.  
  539.     Renames the specified entity. If the entity doesn’t exist kCfgEntityNotfoundErr is returned. If 
  540.     there is already an entity with that name kCfgErrEntityAlreadyExists is returned.
  541. */
  542. EXTERN_API( void )
  543. OTCfgGetEntityArea                (const CfgEntityRef *    entityRef,
  544.                                  CfgAreaID *            areaID);
  545.  
  546. /*
  547.     OTCfgGetEntityArea()
  548.  
  549.     Inputs:        CfgEntityRef *entityRef            Reference to an entity
  550.     Outputs:    CfgAreaID *areaID                ID of area that contains the entity
  551.     Returns:    none
  552.  
  553.     Returns the area ID associated with the specified entity reference.
  554. */
  555. EXTERN_API( void )
  556. OTCfgGetEntityName                (const CfgEntityRef *    entityRef,
  557.                                  Str255                 entityName);
  558.  
  559. /*
  560.     OTCfgGetEntityName()
  561.  
  562.     Inputs:        CfgEntityRef *entityRef            Reference to an entity
  563.     Outputs:    Str255 entityName                Name of the entity
  564.     Returns:    none
  565.  
  566.     Returns the entity name associated with the specified entity reference.
  567. */
  568. EXTERN_API( void )
  569. OTCfgChangeEntityArea            (CfgEntityRef *            entityRef,
  570.                                  CfgAreaID                 newAreaID);
  571.  
  572. /*
  573.     OTCfgChangeEntityArea()
  574.  
  575.     Inputs:        CfgEntityRef *entityRef            Reference to an entity
  576.                 CfgAreaID newAreaID                ID of area to contain moved entity
  577.     Outputs:    none
  578.     Returns:    none
  579.  
  580.     Changes the area ID associated with the specified entity reference. This effectively moves the 
  581.     entity to a different area.
  582. */
  583. /*    -------------------------------------------------------------------------
  584.     These API calls are for the protocol developers to compare the IDs.
  585.     ------------------------------------------------------------------------- */
  586. /*    -------------------------------------------------------------------------
  587.     For OTCfgIsSameEntityRef
  588.     ------------------------------------------------------------------------- */
  589. enum {
  590.     kOTCfgIgnoreArea            = kCfgIgnoreArea,
  591.     kOTCfgDontIgnoreArea        = kCfgDontIgnoreArea
  592. };
  593.  
  594. EXTERN_API( Boolean )
  595. OTCfgIsSameEntityRef            (const CfgEntityRef *    entityRef1,
  596.                                  const CfgEntityRef *    entityRef2,
  597.                                  Boolean                 ignoreArea);
  598.  
  599. /*
  600.     OTCfgIsSameEntityRef()
  601.  
  602.     Inputs:        CfgEntityRef* entityRef1        Reference to an entity
  603.                 CfgEntityRef* entityRef2        Reference to another entity
  604.                 Boolean ignoreArea                If true, ignore the area ID
  605.     Outputs:    none
  606.     Returns:    Boolean                            If true, entity references match
  607.  
  608.     Compare two entity references. If ignoreArea is true, and the two entity names are the same, then return 
  609.     true. If ignoreArea is false, then the area IDs must be the same, as well as the entity names 
  610.     must be the same, then can return true.
  611. */
  612. EXTERN_API( Boolean )
  613. OTCfgIsSameAreaID                (CfgAreaID                 areaID1,
  614.                                  CfgAreaID                 areaID2);
  615.  
  616. /*
  617.     OTCfgIsSameAreaID()
  618.  
  619.     Inputs:        CfgAreaID areaID1                ID of an area
  620.                 CfgAreaID areaID2                ID of another area
  621.     Outputs:    none
  622.     Returns:    Boolean                            If true, area IDs match
  623.  
  624.     Compare two area IDs. Return true for matching area IDs, and return false for the different area IDs.
  625. */
  626. /*    -------------------------------------------------------------------------
  627.     Dealing with individual preferences
  628.     ------------------------------------------------------------------------- */
  629. /*    -------------------------------------------------------------------------
  630.     Open Preferences
  631.     if writer = true, GetPrefs and SetPrefs are allowed, else only GetPrefs is allowed.
  632.     ------------------------------------------------------------------------- */
  633. EXTERN_API( OSStatus )
  634. OTCfgOpenPrefs                    (CfgDatabaseRef         dbRef,
  635.                                  const CfgEntityRef *    entityRef,
  636.                                  Boolean                 writer,
  637.                                  CfgEntityAccessID *    accessID);
  638.  
  639. /*
  640.     OTCfgOpenPrefs()
  641.  
  642.     Inputs:        CfgDatabaseRef dbRef            Reference to opened database
  643.                 CfgEntityRef* entityRef            Reference to an entity
  644.                 Boolean writer                If true, open for write
  645.     Outputs:    CfgEntityAccessID* accessID        ID for entity access
  646.     Returns:    OSStatus                        *** list errors ***
  647.  
  648.     Open the specified entity and return the CfgEntityAccessID for the following access of the 
  649.     content of the entity. If writer is true, CfgGetPrefs and CfgSetPrefs are allowed, otherwise only 
  650.     CfgGetPrefs is allowed.
  651. */
  652. EXTERN_API( OSStatus )
  653. OTCfgClosePrefs                    (CfgEntityAccessID         accessID);
  654.  
  655. /*
  656.     OTCfgClosePrefs()
  657.  
  658.     Inputs:        CfgEntityAccessID* accessID        ID for entity to close
  659.     Outputs:    none
  660.     Returns:    OSStatus                        *** list errors ***
  661.  
  662.     Close the entity with the specified CfgEntityAccessID.
  663. */
  664. /*    -------------------------------------------------------------------------
  665.     Get/Set Preferences
  666.  
  667.     Accessing the content of an entity
  668.  
  669.     These API calls are for the protocol developers. It supports multiple records per entity. Each 
  670.     record is identified by the prefsType and the size of the record. The protocol stack will provide 
  671.     the STRUCT to view the content of each record.
  672.     ------------------------------------------------------------------------- */
  673. EXTERN_API( OSStatus )
  674. OTCfgSetPrefs                    (CfgEntityAccessID         accessID,
  675.                                  OSType                 prefsType,
  676.                                  const void *            data,
  677.                                  ByteCount                 length);
  678.  
  679. /*
  680.     OTCfgSetPrefs()
  681.  
  682.     Inputs:        CfgEntityAccessID* accessID        ID of entity to access
  683.                 OSType prefsType                Record type to set
  684.                 void* data                        Address of data
  685.                 ByteCount length                Number of bytes of data
  686.     Outputs:    none
  687.     Returns:    OSStatus                        *** list errors ***
  688.  
  689.     Write the data to the specified record. The record is identified by the prefsType. If the entity 
  690.     is not opened for the writer, an error code is returned.
  691. */
  692. EXTERN_API( OSStatus )
  693. OTCfgGetPrefs                    (CfgEntityAccessID         accessID,
  694.                                  OSType                 prefsType,
  695.                                  void *                    data,
  696.                                  ByteCount                 length);
  697.  
  698. /*
  699.     OTCfgGetPrefs()
  700.  
  701.     Inputs:        CfgEntityAccessID* accessID        ID of entity to access
  702.                 OSType prefsType                Record type to get
  703.                 void* data                        Address for data
  704.                 ByteCount length                Number of bytes of data requested
  705.     Outputs:    none
  706.     Returns:    OSStatus                        *** list errors ***
  707.  
  708.     Read the data from the specified record to the passed buffer. The record is identified by the 
  709.     prefsType. If the passed buffer is too small, kCfgErrDataTruncated is returned, but will copy as 
  710.     many data as possible to the buffer.
  711. */
  712. EXTERN_API( OSStatus )
  713. OTCfgGetPrefsSize                (CfgEntityAccessID         accessID,
  714.                                  OSType                 prefsType,
  715.                                  ByteCount *            length);
  716.  
  717. /*
  718.     OTCfgGetPrefsSize()
  719.  
  720.     Inputs:        CfgEntityAccessID* accessID        ID of entity to access
  721.                 OSType prefsType                Record type to get
  722.                 ByteCount length                Number of bytes of data available
  723.     Outputs:    none
  724.     Returns:    OSStatus                        *** list errors ***
  725.  
  726.     Returns the length, in bytes, of the specified record. The record is identified by the prefsType.
  727. */
  728. /*    -------------------------------------------------------------------------
  729.     Get table of contents for prefs
  730.     ------------------------------------------------------------------------- */
  731. EXTERN_API( OSStatus )
  732. OTCfgGetPrefsTOCCount            (CfgEntityAccessID         accessID,
  733.                                  ItemCount *            itemCount);
  734.  
  735. /*
  736.     OTCfgGetPrefsTOCCount()
  737.  
  738.     Inputs:        CfgEntityAccessID* accessID        ID of entity to access
  739.     Outputs:    ItemCount* itemCount            Number of entries available
  740.     Returns:    OSStatus                        *** list errors ***
  741.  
  742.     Get the count of all the record headers in the entity. Return the number of records in the count. 
  743. */
  744. EXTERN_API( OSStatus )
  745. OTCfgGetPrefsTOC                (CfgEntityAccessID         accessID,
  746.                                  ItemCount *            itemCount,
  747.                                  CfgPrefsHeader         PrefsTOC[]);
  748.  
  749. /*
  750.     OTCfgGetPrefsTOC()
  751.  
  752.     Inputs:        CfgEntityAccessID* accessID        ID of entity to access
  753.                 ItemCount* itemCount            Number of entries requested
  754.     Outputs:    ItemCount* itemCount            Number of entries available
  755.                 CfgPrefsHeader PrefsTOC[]        Table of entries
  756.     Returns:    OSStatus                        *** list errors ***
  757.  
  758.     Get the list of all the record headers in the entity. Return the number of records in the count. 
  759.     If the PrefsTOC is specified, it has to be big enough to hold all the record headers. If the 
  760.     PrefsTOC is null, only the count is returned.
  761. */
  762. EXTERN_API( SInt16 )
  763. OTCfgEncrypt                    (UInt8 *                key,
  764.                                  UInt8 *                data,
  765.                                  SInt16                 dataLen);
  766.  
  767. /*
  768.     OTCfgEncrypt()
  769.  
  770.     Inputs:        UInt8 *key                        encryption key ( user name )
  771.                 UInt8 *data                        data to encrypt ( password )
  772.                 SInt16 dataLen                    length of data to encrypt
  773.     Outputs:    UInt8 *data                        encrypted data
  774.     Returns:    SInt16                            length of encrypted data
  775.  
  776.     Encrypt the password, using the user name as the encryption key.  Return the encrypted password and its length.  
  777. */
  778. EXTERN_API( SInt16 )
  779. OTCfgDecrypt                    (UInt8 *                key,
  780.                                  UInt8 *                data,
  781.                                  SInt16                 dataLen);
  782.  
  783. /*
  784.     OTCfgDecrypt()
  785.  
  786.     Inputs:        UInt8 *key                        encryption key ( user name )
  787.                 UInt8 *data                        data to decrypt ( password )
  788.                 SInt16 dataLen                    length of data to decrypt
  789.     Outputs:    UInt8 *data                        decrypted data
  790.     Returns:    SInt16                            length of decrypted data
  791.  
  792.     Decrypt the password, using the user name as the encryption key.  Return the decrypted password and its length.  
  793. */
  794. EXTERN_API( Handle )
  795. OTCfgGetDefault                    (ResType                 entityType,
  796.                                  ResType                 entityClass,
  797.                                  ResType                 recordType);
  798.  
  799.  
  800. struct OTCfgNotifierEntry {
  801.     CfgDatabaseRef                     dbRef;
  802.     CfgEntityClass                     theClass;
  803.     CfgEntityType                     theType;
  804.     OTNotifyProcPtr                 notifier;
  805.     void *                            contextPtr;
  806.     CfgAreaID                         theArea;
  807. };
  808. typedef struct OTCfgNotifierEntry        OTCfgNotifierEntry;
  809. EXTERN_API( OSStatus )
  810. OTCfgInstallNotifier            (CfgDatabaseRef         dbRef,
  811.                                  CfgEntityClass         theClass,
  812.                                  CfgEntityType             theType,
  813.                                  OTNotifyProcPtr         notifier,
  814.                                  void *                    contextPtr);
  815.  
  816. EXTERN_API( OSStatus )
  817. OTCfgRemoveNotifier                (CfgDatabaseRef         dbRef,
  818.                                  CfgEntityClass         theClass,
  819.                                  CfgEntityType             theType);
  820.  
  821.  
  822. typedef UInt16                             OTCfgIRPortSetting;
  823. enum {
  824.     kOTCfgTypeStruct            = FOUR_CHAR_CODE('stru'),
  825.     kOTCfgTypeElement            = FOUR_CHAR_CODE('elem'),
  826.     kOTCfgTypeVector            = FOUR_CHAR_CODE('vect')
  827. };
  828.  
  829. /*    -------------------------------------------------------------------------
  830.     CfgEntityClass / CfgEntityType
  831.  
  832.     The database can distinguish between several classes of objects and 
  833.     several types withing each class
  834.     Use of different classes allow to store type of information in the same database
  835.  
  836.     Other entity classes and types can be defined by developers.
  837.     they should be unique and registered with Developer Tech Support (DTS)
  838.     ------------------------------------------------------------------------- */
  839. enum {
  840.     kOTCfgClassNetworkConnection = FOUR_CHAR_CODE('otnc'),
  841.     kOTCfgClassGlobalSettings    = FOUR_CHAR_CODE('otgl'),
  842.     kOTCfgClassServer            = FOUR_CHAR_CODE('otsv'),
  843.     kOTCfgTypeGeneric            = FOUR_CHAR_CODE('otan'),
  844.     kOTCfgTypeAppleTalk            = FOUR_CHAR_CODE('atlk'),
  845.     kOTCfgTypeTCPv4                = FOUR_CHAR_CODE('tcp4'),
  846.     kOTCfgTypeTCPv6                = FOUR_CHAR_CODE('tcp6'),
  847.     kOTCfgTypeRemote            = FOUR_CHAR_CODE('ara '),
  848.     kOTCfgTypeDial                = FOUR_CHAR_CODE('dial'),
  849.     kOTCfgTypeModem                = FOUR_CHAR_CODE('modm'),
  850.     kOTCfgTypeInfrared            = FOUR_CHAR_CODE('infr'),
  851.     kOTCfgClassSetOfSettings    = FOUR_CHAR_CODE('otsc'),
  852.     kOTCfgTypeSetOfSettings        = FOUR_CHAR_CODE('otst'),
  853.     kOTCfgTypeDNS                = FOUR_CHAR_CODE('dns ')
  854. };
  855.  
  856. /*******************************************************************************
  857. ** Preferences Structures
  858. ********************************************************************************/
  859. enum {
  860.     kOTCfgIndexSetsActive        = 0,
  861.     kOTCfgIndexSetsEdit            = 1,
  862.     kOTCfgIndexSetsLimit        = 2                                /*    last value, no comma*/
  863. };
  864.  
  865.  
  866. struct CfgSetsStruct {
  867.     UInt32                             fFlags;
  868.     UInt32                             fTimes[2];
  869. };
  870. typedef struct CfgSetsStruct            CfgSetsStruct;
  871.  
  872. struct CfgSetsElement {
  873.     CfgEntityRef                     fEntityRef;
  874.     CfgEntityInfo                     fEntityInfo;
  875. };
  876. typedef struct CfgSetsElement            CfgSetsElement;
  877.  
  878. struct CfgSetsVector {
  879.     UInt32                             fCount;
  880.     CfgSetsElement                     fElements[1];
  881. };
  882. typedef struct CfgSetsVector            CfgSetsVector;
  883. /*    Common    */
  884. enum {
  885.                                                                 /*    connection    */
  886.     kOTCfgTypeConfigName        = FOUR_CHAR_CODE('cnam'),
  887.     kOTCfgTypeConfigSelected    = FOUR_CHAR_CODE('ccfg'),        /*    transport options    */
  888.     kOTCfgTypeUserLevel            = FOUR_CHAR_CODE('ulvl'),
  889.     kOTCfgTypeWindowPosition    = FOUR_CHAR_CODE('wpos')
  890. };
  891.  
  892. /*    AppleTalk    */
  893. enum {
  894.                                                                 /*    connection    */
  895.     kOTCfgTypeAppleTalkPrefs    = FOUR_CHAR_CODE('atpf'),
  896.     kOTCfgTypeAppleTalkVersion    = FOUR_CHAR_CODE('cvrs'),
  897.     kOTCfgTypeAppleTalkLocks    = FOUR_CHAR_CODE('lcks'),
  898.     kOTCfgTypeAppleTalkPort        = FOUR_CHAR_CODE('port'),
  899.     kOTCfgTypeAppleTalkProtocol    = FOUR_CHAR_CODE('prot'),
  900.     kOTCfgTypeAppleTalkPassword    = FOUR_CHAR_CODE('pwrd'),
  901.     kOTCfgTypeAppleTalkPortFamily = FOUR_CHAR_CODE('ptfm')        /*    transport options    */
  902. };
  903.  
  904. enum {
  905.     kOTCfgIndexAppleTalkAARP    = 0,
  906.     kOTCfgIndexAppleTalkDDP        = 1,
  907.     kOTCfgIndexAppleTalkNBP        = 2,
  908.     kOTCfgIndexAppleTalkZIP        = 3,
  909.     kOTCfgIndexAppleTalkATP        = 4,
  910.     kOTCfgIndexAppleTalkADSP    = 5,
  911.     kOTCfgIndexAppleTalkPAP        = 6,
  912.     kOTCfgIndexAppleTalkASP        = 7,
  913.     kOTCfgIndexAppleTalkLast    = 7
  914. };
  915.  
  916.  
  917. struct OTCfgAppleTalkPrefs {
  918.     UInt16                             fVersion;
  919.     UInt16                             fNumPrefs;
  920.     OTPortRef                         fPort;
  921.     void *                            fLink;
  922.     void *                            fPrefs[8];
  923. };
  924. typedef struct OTCfgAppleTalkPrefs        OTCfgAppleTalkPrefs;
  925.  
  926. struct OTCfgAARPPrefs {
  927.     UInt16                             fVersion;
  928.     UInt16                             fSize;
  929.     UInt32                             fAgingCount;
  930.     UInt32                             fAgingInterval;
  931.     size_t                             fProtAddrLen;
  932.     size_t                             fHWAddrLen;
  933.     UInt32                             fMaxEntries;
  934.     size_t                             fProbeInterval;
  935.     size_t                             fProbeRetryCount;
  936.     size_t                             fRequestInterval;
  937.     size_t                             fRequestRetryCount;
  938. };
  939. typedef struct OTCfgAARPPrefs            OTCfgAARPPrefs;
  940.  
  941. struct OTCfgDDPPrefs {
  942.     UInt16                             fVersion;
  943.     UInt16                             fSize;
  944.     UInt32                             fTSDUSize;
  945.     UInt8                             fLoadType;
  946.     UInt8                             fNode;
  947.     UInt16                             fNetwork;
  948.     UInt16                             fRTMPRequestLimit;
  949.     UInt16                             fRTMPRequestInterval;
  950.     UInt32                             fAddressGenLimit;
  951.     UInt32                             fBRCAgingInterval;
  952.     UInt32                             fRTMPAgingInterval;
  953.     UInt32                             fMaxAddrTries;
  954.     Boolean                         fDefaultChecksum;
  955.     Boolean                         fIsFixedNode;
  956.     UInt8                             fMyZone[33];
  957. };
  958. typedef struct OTCfgDDPPrefs            OTCfgDDPPrefs;
  959.  
  960. struct OTCfgATPFPrefs {
  961.     OTCfgAppleTalkPrefs             fAT;
  962.     OTCfgAARPPrefs                     fAARP;
  963.     OTCfgDDPPrefs                     fDDP;
  964.     char                             fFill[122];
  965. };
  966. typedef struct OTCfgATPFPrefs            OTCfgATPFPrefs;
  967. /*    Infrared    */
  968. enum {
  969.     kOTCfgTypeInfraredPrefs        = FOUR_CHAR_CODE('atpf'),
  970.     kOTCfgTypeInfraredGlobal    = FOUR_CHAR_CODE('irgo')
  971. };
  972.  
  973.  
  974. struct OTCfgIRPrefs {
  975.     CfgPrefsHeader                     fHdr;
  976.     OTPortRef                         fPort;                        /*    OT port id*/
  977.     OTCfgIRPortSetting                 fPortSetting;                /*    Ir protocol,  irda or irtalk*/
  978.     Boolean                         fNotifyOnDisconnect;        /*    notify user on irda disconnect?*/
  979.     Boolean                         fDisplayIRControlStrip;        /*    show ir control strip?*/
  980.     Point                             fWindowPosition;            /*    The position of the editor window*/
  981. };
  982. typedef struct OTCfgIRPrefs                OTCfgIRPrefs;
  983.  
  984. struct OTCfgIRGlobal {
  985.     CfgPrefsHeader                     fHdr;                        /* standard prefererences header*/
  986.     UInt32                             fOptions;                    /* options bitmask*/
  987.     UInt32                             fNotifyMask;                /* Notification options.*/
  988.     UInt32                             fUnloadTimeout;                /* Unload timeout (in milliseconds)*/
  989. };
  990. typedef struct OTCfgIRGlobal            OTCfgIRGlobal;
  991. /*    TCP/IP v4    */
  992. enum {
  993.                                                                 /*    connection    */
  994.     kOTCfgTypeTCPalis            = FOUR_CHAR_CODE('alis'),
  995.     kOTCfgTypeTCPcvrs            = FOUR_CHAR_CODE('cvrs'),
  996.     kOTCfgTypeTCPdcid            = FOUR_CHAR_CODE('dcid'),
  997.     kOTCfgTypeTCPdclt            = FOUR_CHAR_CODE('dclt'),
  998.     kOTCfgTypeTCPdtyp            = FOUR_CHAR_CODE('dtyp'),
  999.     kOTCfgTypeTCPidns            = FOUR_CHAR_CODE('idns'),
  1000.     kOTCfgTypeTCPihst            = FOUR_CHAR_CODE('ihst'),
  1001.     kOTCfgTypeTCPiitf            = FOUR_CHAR_CODE('iitf'),
  1002.     kOTCfgTypeTCPara            = FOUR_CHAR_CODE('ipcp'),
  1003.     kOTCfgTypeTCPirte            = FOUR_CHAR_CODE('irte'),
  1004.     kOTCfgTypeTCPisdm            = FOUR_CHAR_CODE('isdm'),
  1005.     kOTCfgTypeTCPstng            = FOUR_CHAR_CODE('stng'),
  1006.     kOTCfgTypeTCPunld            = FOUR_CHAR_CODE('unld'),
  1007.     kOTCfgTypeTCPVersion        = FOUR_CHAR_CODE('cvrs'),        /*    Version */
  1008.     kOTCfgTypeTCPDevType        = FOUR_CHAR_CODE('dvty'),
  1009.     kOTCfgTypeTCPPrefs            = FOUR_CHAR_CODE('iitf'),
  1010.     kOTCfgTypeTCPServersList    = FOUR_CHAR_CODE('idns'),
  1011.     kOTCfgTypeTCPSearchList        = FOUR_CHAR_CODE('ihst'),
  1012.     kOTCfgTypeTCPRoutersList    = FOUR_CHAR_CODE('irte'),
  1013.     kOTCfgTypeTCPDomainsList    = FOUR_CHAR_CODE('isdm'),
  1014.     kOTCfgTypeTCPPort            = FOUR_CHAR_CODE('port'),        /*    Ports */
  1015.     kOTCfgTypeTCPProtocol        = FOUR_CHAR_CODE('prot'),
  1016.     kOTCfgTypeTCPPassword        = FOUR_CHAR_CODE('pwrd'),        /*    Password */
  1017.     kOTCfgTypeTCPLocks            = FOUR_CHAR_CODE('stng'),        /*    locks */
  1018.     kOTCfgTypeTCPUnloadType        = FOUR_CHAR_CODE('unld')        /*    transport options    */
  1019. };
  1020.  
  1021.  
  1022.  
  1023. struct OTCfgIDNSPrefs {
  1024.     short                             fCount;
  1025.     InetHost                         fAddressesList;
  1026. };
  1027. typedef struct OTCfgIDNSPrefs            OTCfgIDNSPrefs;
  1028.  
  1029. struct OTCfgHSTFPrefs {
  1030.     char                             fPrimaryInterfaceIndex;        /*    always 1 in OT 1.0 / 1.1*/
  1031.                                                                 /*    this structure IS packed!*/
  1032.     UInt8                             fLocalDomainName[256];
  1033.                                                                 /*    followed by */
  1034.     UInt8                             admindomain[256];
  1035. };
  1036. typedef struct OTCfgHSTFPrefs            OTCfgHSTFPrefs;
  1037. /*    This is your worst case, a fixed size structure, tacked on after a variable length string.*/
  1038. //    Use the macro to help access the movable beast.
  1039.  
  1040. #define    kIITFPartP( h ) ( (OTCfgIITFPrefsPart*) &( (**( (OTCfgIITFPrefs**) h )).fAppleTalkZone[ (**( (OTCfgIITFPrefs**) h )).fAppleTalkZone[0] + 1 ] ) )
  1041.  
  1042. /*
  1043.       This structure also contains an IP address and subnet mask that are not aligned on a four byte boundary.  
  1044.       In order to avoid compiler warnings, and the possibility of code that won't work, 
  1045.       these fields are defined here as four character arrays.  
  1046.       It is suggested that BlockMoveData be used to copy to and from a field of type InetHost.  
  1047. */
  1048.  
  1049. struct OTCfgIITFPrefsPart {
  1050.     char                             path[36];
  1051.     char                             module[32];
  1052.     unsigned long                     framing;
  1053. };
  1054. typedef struct OTCfgIITFPrefsPart        OTCfgIITFPrefsPart;
  1055.  
  1056. struct OTCfgIITFPrefs {
  1057.     short                             fCount;
  1058.     UInt8                             fConfigMethod;
  1059.                                                                 /*    this structure IS packed!*/
  1060.                                                                 /*    Followed by:*/
  1061.     UInt8                             fIPAddress[4];
  1062.     UInt8                             fSubnetMask[4];
  1063.     UInt8                             fAppleTalkZone[256];
  1064.                                                                 /*    this structure IS packed!*/
  1065.     UInt8                             fFiller;
  1066.     OTCfgIITFPrefsPart                 part;
  1067. };
  1068. typedef struct OTCfgIITFPrefs            OTCfgIITFPrefs;
  1069.  
  1070. struct OTCfgIRTEEntry {
  1071.     InetHost                         fToHost;                    /*    always 0;*/
  1072.     InetHost                         fViaHost;                    /*    router address;*/
  1073.     short                             fLocal;                        /*    always 0*/
  1074.     short                             fHost;                        /*    always 0*/
  1075. };
  1076. typedef struct OTCfgIRTEEntry            OTCfgIRTEEntry;
  1077.  
  1078. struct OTCfgIRTEPrefs {
  1079.     short                             fCount;
  1080.     OTCfgIRTEEntry                     fList[1];
  1081. };
  1082. typedef struct OTCfgIRTEPrefs            OTCfgIRTEPrefs;
  1083.  
  1084. struct OTCfgISDMPrefs {
  1085.     short                             fCount;
  1086.     Str255                             fDomainsList;
  1087. };
  1088. typedef struct OTCfgISDMPrefs            OTCfgISDMPrefs;
  1089.  
  1090. struct OTCfgDHCPRecord {
  1091.     InetHost                         ipIPAddr;
  1092.     InetHost                         ipConfigServer;
  1093.     UInt32                             ipLeaseGrantTime;
  1094.     UInt32                             ipLeaseExpirationTime;
  1095. };
  1096. typedef struct OTCfgDHCPRecord            OTCfgDHCPRecord;
  1097. /*    DNS    */
  1098. enum {
  1099.                                                                 /*    connection    */
  1100.     kOTCfgTypeDNSidns            = FOUR_CHAR_CODE('idns'),
  1101.     kOTCfgTypeDNSisdm            = FOUR_CHAR_CODE('isdm'),
  1102.     kOTCfgTypeDNSihst            = FOUR_CHAR_CODE('ihst'),
  1103.     kOTCfgTypeDNSstng            = FOUR_CHAR_CODE('stng'),
  1104.     kOTCfgTypeDNSPassword        = FOUR_CHAR_CODE('pwrd')        /*    transport options    */
  1105. };
  1106.  
  1107. /*    Modem    */
  1108. enum {
  1109.                                                                 /*    connection    */
  1110.     kOTCfgTypeModemModem        = FOUR_CHAR_CODE('ccl '),        /*    Type for Modem configuration resource*/
  1111.     kOTCfgTypeModemLocks        = FOUR_CHAR_CODE('lkmd'),        /*    Types for lock resources*/
  1112.     kOTCfgTypeModemAdminPswd    = FOUR_CHAR_CODE('mdpw'),        /*    Password*/
  1113.                                                                 /*    transport options    */
  1114.     kOTCfgTypeModemApp            = FOUR_CHAR_CODE('mapt')
  1115. };
  1116.  
  1117.  
  1118. struct OTCfgRemoteConfigModem {
  1119.     UInt32                             version;
  1120.     Boolean                         useModemScript;
  1121.     char                             pad00;                        /*    this structure is NOT packed!*/
  1122.     FSSpec                             modemScript;
  1123.     Boolean                         modemSpeakerOn;
  1124.     Boolean                         modemPulseDial;
  1125.     UInt32                             modemDialToneMode;
  1126.     SInt8                             lowerLayerName[36];
  1127. };
  1128. typedef struct OTCfgRemoteConfigModem    OTCfgRemoteConfigModem;
  1129.  
  1130. struct OTCfgModemLocks {
  1131.     UInt32                             version;
  1132.     UInt32                             port;
  1133.     UInt32                             script;
  1134.     UInt32                             speaker;
  1135.     UInt32                             dialing;
  1136. };
  1137. typedef struct OTCfgModemLocks            OTCfgModemLocks;
  1138.  
  1139. struct OTCfgModemAppPrefs {
  1140.     UInt32                             version;
  1141.     Point                             windowPos;
  1142.     SInt32                             userMode;
  1143. };
  1144. typedef struct OTCfgModemAppPrefs        OTCfgModemAppPrefs;
  1145. /*    Remote Access    */
  1146. enum {
  1147.                                                                 /*    connection    */
  1148.     kOTCfgTypeRemoteARAP        = FOUR_CHAR_CODE('arap'),
  1149.     kOTCfgTypeRemoteAddress        = FOUR_CHAR_CODE('cadr'),
  1150.     kOTCfgTypeRemoteChat        = FOUR_CHAR_CODE('ccha'),
  1151.     kOTCfgTypeRemoteDialing        = FOUR_CHAR_CODE('cdia'),
  1152.     kOTCfgTypeRemoteExtAddress    = FOUR_CHAR_CODE('cead'),
  1153.     kOTCfgTypeRemoteClientLocks    = FOUR_CHAR_CODE('clks'),
  1154.     kOTCfgTypeRemoteClientMisc    = FOUR_CHAR_CODE('cmsc'),
  1155.     kOTCfgTypeRemoteConnect        = FOUR_CHAR_CODE('conn'),
  1156.     kOTCfgTypeRemoteUser        = FOUR_CHAR_CODE('cusr'),
  1157.     kOTCfgTypeRemoteDialAssist    = FOUR_CHAR_CODE('dass'),
  1158.     kOTCfgTypeRemoteIPCP        = FOUR_CHAR_CODE('ipcp'),
  1159.     kOTCfgTypeRemoteLCP            = FOUR_CHAR_CODE('lcp '),        /* trailing space is important! */
  1160.     kOTCfgTypeRemoteLogOptions    = FOUR_CHAR_CODE('logo'),
  1161.     kOTCfgTypeRemotePassword    = FOUR_CHAR_CODE('pass'),
  1162.     kOTCfgTypeRemotePort        = FOUR_CHAR_CODE('port'),
  1163.     kOTCfgTypeRemoteServerLocks    = FOUR_CHAR_CODE('slks'),
  1164.     kOTCfgTypeRemoteServer        = FOUR_CHAR_CODE('srvr'),
  1165.     kOTCfgTypeRemoteUserMode    = FOUR_CHAR_CODE('usmd'),
  1166.     kOTCfgTypeRemoteX25            = FOUR_CHAR_CODE('x25 '),        /* trailing space is important! */
  1167.                                                                 /*    transport options    */
  1168.     kOTCfgTypeRemoteApp            = FOUR_CHAR_CODE('capt')
  1169. };
  1170.  
  1171. /*******************************************************************************
  1172. *    OTCfgRemoteLogOptions
  1173. *
  1174. *    This structure is appended to OTCfgRemoteConnect records in the 
  1175. *    OTCfgRemoteConnect::additional list.
  1176. *
  1177. *    NOTE
  1178. *
  1179. *    All OTCfgRemoteConnect::additional structures MUST have the same fields up to
  1180. *    the "additional" field.  See OTCfgRemoteX25Info.
  1181. ********************************************************************************/
  1182.  
  1183. struct OTCfgRemoteLogOptions {
  1184.     UInt32                             version;
  1185.     UInt32                             fType;                        /*    kRAConnectAdditionalLogOptions*/
  1186.     void *                            additional;
  1187.     UInt32                             logLevel;                    /*    values defined above.*/
  1188.     UInt32                             reserved[4];                /*    for later use.*/
  1189. };
  1190. typedef struct OTCfgRemoteLogOptions    OTCfgRemoteLogOptions;
  1191. /*******************************************************************************
  1192. *    New structures for dialing mode, phone numbers, and configuration stats.
  1193. *    
  1194. *    
  1195. ********************************************************************************/
  1196. enum {
  1197.     kOTCfgRemoteMaxAddressSize    = (255 + 1)
  1198. };
  1199.  
  1200.  
  1201. struct OTCfgRemoteAddress {
  1202.     struct OTCfgRemoteAddress *        next;
  1203.     UInt8                             address[256];
  1204. };
  1205. typedef struct OTCfgRemoteAddress        OTCfgRemoteAddress;
  1206. /*******************************************************************************
  1207. *    OTCfgRemoteDialing
  1208. *
  1209. *    This structure is appended to OTCfgRemoteConnect records in the 
  1210. *    OTCfgRemoteConnect::additional list.
  1211. *
  1212. *    NOTE
  1213. *
  1214. *    All OTCfgRemoteConnect::additional structures MUST have the same fields up to
  1215. *    the "additional" field.  See OTCfgRemoteX25Info.
  1216. ********************************************************************************/
  1217.  
  1218. struct OTCfgRemoteDialing {
  1219.     UInt32                             version;
  1220.     UInt32                             fType;                        /*    kRAConnectAdditionalDialing*/
  1221.     void *                            additional;
  1222.     UInt32                             dialMode;                    /*    values defined above.*/
  1223.     SInt32                             redialTries;
  1224.     UInt32                             redialDelay;                /*    in seconds.*/
  1225.     OTCfgRemoteAddress *            addresses;
  1226. };
  1227. typedef struct OTCfgRemoteDialing        OTCfgRemoteDialing;
  1228. /*******************************************************************************
  1229. *    OTCfgRemoteScript
  1230. *
  1231. *    This is appended to OTCfgRemoteConnect records in the "additional" list.
  1232. *    It is currently only used for passing in a modem script to override
  1233. *    the default script.  Connect scripts have their own field in OTCfgRemoteConnect.
  1234. *
  1235. *    NOTE
  1236. *
  1237. *    All OTCfgRemoteConnect::additional structures MUST have the same fields up to
  1238. *    the "additional" field.  See OTCfgRemoteX25Info and OTCfgRemoteDialing.
  1239. ********************************************************************************/
  1240.  
  1241. struct OTCfgRemoteScript {
  1242.     UInt32                             version;
  1243.     UInt32                             fType;                        /*    kRAConnectAdditionalScript*/
  1244.     void *                            additional;
  1245.     UInt32                             scriptType;
  1246.     UInt32                             scriptLength;
  1247.     UInt8 *                            scriptData;
  1248. };
  1249. typedef struct OTCfgRemoteScript        OTCfgRemoteScript;
  1250. /*******************************************************************************
  1251. *    Miscellaneous limits
  1252. *    The size limits for strings include a 1 byte for the string length or
  1253. *    a terminating NULL character.
  1254. ********************************************************************************/
  1255. enum {
  1256.     kOTCfgRemoteMaxPasswordLength = 255,
  1257.     kOTCfgRemoteMaxPasswordSize    = (255 + 1),
  1258.     kOTCfgRemoteMaxUserNameLength = 255,
  1259.     kOTCfgRemoteMaxUserNameSize    = (255 + 1),
  1260.     kOTCfgRemoteMaxAddressLength = 255,                            /*    kOTCfgRemoteMaxAddressSize                    = (255 + 1),*/
  1261.     kOTCfgRemoteMaxServerNameLength = 32,
  1262.     kOTCfgRemoteMaxServerNameSize = (32 + 1),
  1263.     kOTCfgRemoteMaxMessageLength = 255,
  1264.     kOTCfgRemoteMaxMessageSize    = (255 + 1),
  1265.     kOTCfgRemoteMaxX25ClosedUserGroupLength = 4,
  1266.     kOTCfgRemoteInfiniteSeconds    = (long)0xFFFFFFFF,
  1267.     kOTCfgRemoteMinReminderMinutes = 1,
  1268.     kOTCfgRemoteChatScriptFileCreator = FOUR_CHAR_CODE('ttxt'),
  1269.     kOTCfgRemoteChatScriptFileType = FOUR_CHAR_CODE('TEXT'),
  1270.     kOTCfgRemoteMaxChatScriptLength = 0x8000
  1271. };
  1272.  
  1273. /*******************************************************************************
  1274. *    X.25 connection information, added to OTCfgRemoteConnect's additional info list.
  1275. *
  1276. *    NOTE
  1277. *
  1278. *    All OTCfgRemoteConnect::additional structures MUST have the same fields up to
  1279. *    the "additional" field.  See OTCfgRemoteScript & OTCfgRemoteDialing.
  1280. ********************************************************************************/
  1281.  
  1282. struct OTCfgRemoteX25Info {
  1283.     UInt32                             version;
  1284.     UInt32                             fType;                        /*    kRAConnectAdditionalX25*/
  1285.     void *                            additional;                    /*    Ptr to additional connect info*/
  1286.     FSSpec                             script;                        /*    PAD's CCL script*/
  1287.     UInt8                             address[256];                /*    address of server*/
  1288.     UInt8                             userName[256];
  1289.                                                                 /*    network user ID*/
  1290.     UInt8                             closedUserGroup[5];
  1291.                                                                 /*    closed user group*/
  1292.     Boolean                         reverseCharge;                /*    request reverse charging*/
  1293. };
  1294. typedef struct OTCfgRemoteX25Info        OTCfgRemoteX25Info;
  1295. /*******************************************************************************
  1296. *    OTCfgRemoteDisconnect
  1297. *
  1298. *    Use this structure to terminate Remote Access connections.
  1299. ********************************************************************************/
  1300.  
  1301. struct OTCfgRemoteDisconnect {
  1302.     UInt32                             whenSeconds;                /*    Number of seconds until disconnect*/
  1303.     UInt32                             showStatus;                    /*    Show disconnect status window*/
  1304. };
  1305. typedef struct OTCfgRemoteDisconnect    OTCfgRemoteDisconnect;
  1306. /*******************************************************************************
  1307. *    OTCfgRemoteIsRemote
  1308. *
  1309. *    Use this structure to find out if an AppleTalk address is on the 
  1310. *    remote side of the current ARA link. The "isRemote" field is set to
  1311. *    "true" if the address is remote. 
  1312. ********************************************************************************/
  1313.  
  1314. struct OTCfgRemoteIsRemote {
  1315.     UInt32                             net;                        /*    AppleTalk network number*/
  1316.     UInt32                             node;                        /*    AppleTalk node number*/
  1317.     UInt32                             isRemote;                    /*    returned.*/
  1318. };
  1319. typedef struct OTCfgRemoteIsRemote        OTCfgRemoteIsRemote;
  1320. /*******************************************************************************
  1321. *    OTCfgRemoteConnect
  1322. *
  1323. *    Use this structure to initiate Remote Access connections.
  1324. ********************************************************************************/
  1325.  
  1326. struct OTCfgRemoteConnect {
  1327.     UInt32                             version;
  1328.     UInt32                             fType;                        /*    RAConnectType defined above.*/
  1329.     UInt32                             isGuest;                    /*    (boolean) True for guest login*/
  1330.     UInt32                             canInteract;                /*    (boolean) True if dialogs can be displayed*/
  1331.     UInt32                             showStatus;                    /*    (boolean) Display (dis)connection status dialogs?*/
  1332.     UInt32                             passwordSaved;                /*    (boolean) "Save Password" checked in doc.*/
  1333.     UInt32                             flashConnectedIcon;            /*    (boolean) Flash icon in menu bar*/
  1334.     UInt32                             issueConnectedReminders;    /*    (boolean) Use Notification Manager reminders*/
  1335.     SInt32                             reminderMinutes;            /*    How long between each reminder?*/
  1336.     UInt32                             connectManually;            /*    (boolean) True if we are connecting manually*/
  1337.     UInt32                             allowModemDataCompression;    /*    (boolean) currently, only for kSerialProtoPPP*/
  1338.     UInt32                             chatMode;                    /*    Flags defined above*/
  1339.     UInt32                             serialProtocolMode;            /*    Flags defined above*/
  1340.  
  1341.     UInt8 *                            password;
  1342.     UInt8 *                            userName;
  1343.     UInt32                             addressLength;                /*    Length of phone number or other address*/
  1344.     UInt8 *                            address;                    /*    Phone number or address data*/
  1345.     Str63                             chatScriptName;                /*    Name of imported chat script (informational only)*/
  1346.     UInt32                             chatScriptLength;            /*    Length of Chat script*/
  1347.     UInt8 *                            chatScript;                    /*    Chat script data*/
  1348.  
  1349.     void *                            additional;                    /*    Ptr to additional connect info,*/
  1350.                                                                 /*    such as OTCfgRemoteX25Info*/
  1351.  
  1352.     UInt32                             useSecurityModule;            /*    (boolean) use line-level security module ?*/
  1353.     OSType                             securitySignature;            /*    signature of security module file*/
  1354.     UInt32                             securityDataLength;            /*    0..kSecurityMaxConfigData*/
  1355.     UInt8 *                            securityData;                /*    Ptr to data of size securityDataLength*/
  1356. };
  1357. typedef struct OTCfgRemoteConnect        OTCfgRemoteConnect;
  1358. /*******************************************************************************
  1359. *    OTCfgRemoteConnectInfo
  1360. *
  1361. *    If requestCode = kRAGetConnectInfo, "connectInfo" returns a pointer to a
  1362. *    new OTCfgRemoteConnect block that describes the current connection.
  1363. *
  1364. *    If requestCode = kRADisposeConnectInfo, the memory pointed to by
  1365. *    "connectInfo" is released for reuse.  "connectInfo" must point to a valid
  1366. *    OTCfgRemoteConnect structure previously returned by kRAGetConnectInfo.
  1367. ********************************************************************************/
  1368.  
  1369. struct OTCfgRemoteConnectInfo {
  1370.     OTCfgRemoteConnect *            connectInfo;                /*    Returned or disposed, depending on requestCode*/
  1371. };
  1372. typedef struct OTCfgRemoteConnectInfo    OTCfgRemoteConnectInfo;
  1373. /*******************************************************************************
  1374. *    OTCfgRemoteStatus
  1375. *
  1376. *    Use this structure to get the status of Remote Access connections.
  1377. ********************************************************************************/
  1378. enum {
  1379.     kOTCfgRemoteStatusIdle        = 1,
  1380.     kOTCfgRemoteStatusConnecting = 2,
  1381.     kOTCfgRemoteStatusConnected    = 3,
  1382.     kOTCfgRemoteStatusDisconnecting = 4
  1383. };
  1384.  
  1385.  
  1386.  
  1387. struct OTCfgRemoteStatus {
  1388.     UInt32                             status;                        /*    values defined above*/
  1389.     Boolean                         answerEnabled;
  1390.     char                             pad00;                        /*    This structure is NOT packed*/
  1391.     UInt32                             secondsConnected;
  1392.     UInt32                             secondsRemaining;
  1393.     UInt8                             userName[256];                /*    Pascal format*/
  1394.     UInt8                             serverName[33];                /*    Pascal format*/
  1395.     char                             pad01;                        /*    This structure is NOT packed*/
  1396.     UInt32                             messageIndex;
  1397.     UInt8                             message[256];                /*    Pascal format*/
  1398.     UInt32                             serialProtocolMode;            /*    Flags defined above.*/
  1399.     UInt8                             baudMessage[256];            /*    Pascal format*/
  1400.     Boolean                         isServer;
  1401.     char                             pad02;                        /*    This structure is NOT packed*/
  1402.     UInt32                             bytesIn;
  1403.     UInt32                             bytesOut;
  1404.     UInt32                             linkSpeed;
  1405.     UInt32                             localIPAddress;
  1406.     UInt32                             remoteIPAddress;
  1407. };
  1408. typedef struct OTCfgRemoteStatus        OTCfgRemoteStatus;
  1409. /*******************************************************************************
  1410. *    OTCfgRemoteUserMessage
  1411. *
  1412. *    Use this structure when converting result codes into user messages.
  1413. ********************************************************************************/
  1414.  
  1415. struct OTCfgRemoteUserMessage {
  1416.     UInt32                             version;
  1417.     SInt32                             messageID;
  1418.     UInt8                             userMessage[256];
  1419.     UInt8                             userDiagnostic[256];
  1420. };
  1421. typedef struct OTCfgRemoteUserMessage    OTCfgRemoteUserMessage;
  1422. /*******************************************************************************
  1423. *    OTCfgRemoteNotifier
  1424. *
  1425. *    Use this structure to install a procedure to receive asynchronous 
  1426. *    Remote Access notifications.
  1427. ********************************************************************************/
  1428.  
  1429. typedef UInt32                             OTCfgRemoteEventCode;
  1430. typedef CALLBACK_API_C( void , RANotifyProcPtr )(void *contextPtr, OTCfgRemoteEventCode code, OSStatus result, void *cookie);
  1431.  
  1432. struct OTCfgRemoteNotifier {
  1433.     RANotifyProcPtr                 procPtr;
  1434.     void *                            contextPtr;
  1435. };
  1436. typedef struct OTCfgRemoteNotifier        OTCfgRemoteNotifier;
  1437. /*******************************************************************************
  1438. *    OTCfgRemoteRequest
  1439. *
  1440. *    All Remote Access API calls must pass a pointer to an OTCfgRemoteRequest structure.
  1441. ********************************************************************************/
  1442.  
  1443. struct OTCfgRemoteRequest {
  1444.     SInt8                             reserved1[16];                /*    Do not use. */
  1445.     OSErr                             result;                        /*    <--*/
  1446.     SInt8                             reserved2[8];                /*    Do not use.*/
  1447.     SInt16                             requestCode;                /*     -->*/
  1448.     SInt16                             portId;                        /*    <-->*/
  1449.     union {
  1450.         OTCfgRemoteNotifier             Notifier;
  1451.         OTCfgRemoteConnect                 Connect;
  1452.         OTCfgRemoteDisconnect             Disconnect;
  1453.         OTCfgRemoteStatus                 Status;
  1454.         OTCfgRemoteIsRemote             IsRemote;
  1455.         OTCfgRemoteConnectInfo             ConnectInfo;
  1456.     }                                 fType;
  1457. };
  1458. typedef struct OTCfgRemoteRequest        OTCfgRemoteRequest;
  1459.  
  1460. struct OTCfgRemoteConfigCAPT {
  1461.     UInt32                             fWord1;
  1462.     Point                             fWindowPosition;
  1463.     UInt32                             fWord3;
  1464.     UInt32                             fUserLevel;
  1465.     UInt32                             fSetupVisible;
  1466. };
  1467. typedef struct OTCfgRemoteConfigCAPT    OTCfgRemoteConfigCAPT;
  1468. #endif  /* CALL_NOT_IN_CARBON */
  1469.  
  1470.  
  1471. #if PRAGMA_STRUCT_ALIGN
  1472.     #pragma options align=reset
  1473. #elif PRAGMA_STRUCT_PACKPUSH
  1474.     #pragma pack(pop)
  1475. #elif PRAGMA_STRUCT_PACK
  1476.     #pragma pack()
  1477. #endif
  1478.  
  1479. #ifdef PRAGMA_IMPORT_OFF
  1480. #pragma import off
  1481. #elif PRAGMA_IMPORT
  1482. #pragma import reset
  1483. #endif
  1484.  
  1485. #ifdef __cplusplus
  1486. }
  1487. #endif
  1488.  
  1489. #endif /* __NETWORKSETUP__ */
  1490.  
  1491.